package com.red.wood.distinct;

import java.util.List;
import java.util.Map;

import org.junit.Ignore;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;

import com.red.wood.base.BaseTest;
import com.red.wood.common.springjdbc.CommonDao;

public class CdnDistinct extends BaseTest{
	
	@Autowired
	private CommonDao dao;
	
	@Test
	@Ignore
	public void domain() {

		StringBuilder sqlSb = new StringBuilder("select cdnId,customerId,serviceId,domainId,domain,regId,topDomain,unitName,timstamp from t_cdn_customer_service_domain GROUP BY cdnId,customerId,serviceId,domainId,domain,regId,topDomain,unitName,timstamp");
		List<Map<String, Object>> list = dao.queryTableData(null, sqlSb);
		
		dao.deleteTableData("delete from t_cdn_customer_service_domain");
		String sql = "insert into t_cdn_customer_service_domain(cdnId,customerId,serviceId,domainId,domain,regId,topDomain,unitName,timstamp) values (?,?,?,?,?,?,?,?,?)";
		String columns = "cdnId,customerId,serviceId,domainId,domain,regId,topDomain,unitName,timstamp";
		dao.insertBatchTableData(list, sql, columns,5000);
	
	}
}
